/*
* =====================================================================================
*
*       Filename:  mem.h
*
*    Description:  
*
*        Version:  1.0
*        Created:  2010年09月18日 11时44分40秒
*       Revision:  none
*       Compiler:  gcc
*
*         Author:  YOUR NAME (), 
*        Company:  
*
* =====================================================================================
*/
#ifndef MEM_INCLUDE
#define MEM_INCLUDE

#include <stddef.h>
#include "except.h"

extern except_t Allocation_Failed;
extern except_t FreeNullPointer_Failed;

#define ALLOC(s) mem_malloc((s))
#define NEW(p) ALLOC(sizeof(*(p))) 
#define NEW0(p) CALLOC(1, sizeof(*(p)))
#define REALLOC(b, s) mem_realloc((b), (s)) 
#define FREE(p) mem_free((p))

void *mem_calloc(size_t nmemb, size_t size);
void *mem_malloc(size_t size);
void mem_free(void *ptr);
void *mem_realloc(void *ptr, size_t size);

#endif
